<template>
    <a-upload
            class="k-upload"
            :file-list="fileList"
            :remove="handleRemove"
            :before-upload="beforeUpload"
            accept=".xls,.xlsx"
    >
        <a-button> <a-icon type="upload" /> 添加文件 </a-button>
    </a-upload>
</template>
<script>
    export default {
        data() {
            return {
                fileList: []
            };
        },
        methods: {
            handleRemove(file) {
                const index = this.fileList.indexOf(file);
                const newFileList = this.fileList.slice();
                newFileList.splice(index, 1);
                this.fileList = newFileList;
            },
            beforeUpload(file) {
                this.fileList = [file];
                return false;
            },
        },
    };
</script>
<style lang="less">
    .k-upload{
        width: 400px;
        .ant-upload-list-item{
            width: 400px;
        }
        button{
            border-color: #2c9af2!important;
            color: #2c9af2!important;
        }
    }
</style>